//
//  main.c
//  PyroTools
//
//  Created by Timothée Poisot on 10/07/11.
//  Copyright 2011 Université Montpellier 2. All rights reserved.
//

#include <stdio.h>
#include <math.h> 
#include <stdlib.h>
#include <string.h>
#include <time.h>

// Functions for general stat
#include "stat-functions.h"
// Functions for genetic distances
#include "genet-functions.h"
// General modules
#include "modules.h"

int listofcommands(int i)
{
    printf("Available commands\n\n");
    //
    printf("beta\tBeta diversity between two samples\n");
    printf("USE\tbeta s1.pop s2.pop s1.seq s2.seq outputfile\n\n");
    //
    printf("newf\tCreate a new output file in the current directory\n");
    printf("USE\tnewf outputfile\n\n");
    return(i);
}

// Main function
int main (int argc, const char * argv[])
{
    printf("\n-----------------------------------------------");
    printf("\n| PyroTools | Analyses of pyrosequencing data |");
    printf("\n-----------------------------------------------");
    printf("\n| Timothee Poisot                             |");
    printf("\n| Universite Montpellier 2                    |");
    printf("\n| tpoisot@um2.fr                              |");
    printf("\n-----------------------------------------------\n");
        
    if(argc>1)
    {
        if(strcmp(argv[1], "beta")==0){
            printf("\nBETA DIVERSITY BETWEEN TWO SAMPLES\n\n");
            betadiv(argv);
        } else  if(strcmp(argv[1], "newf")==0){
            printf("\nNEW OUTPUT FILE\n\n");
            newoutfile(argv);
        } else {
            printf("ERROR : command unknown\n");
            listofcommands(0);
        }
    } else {
        printf("ERROR : no command specified\n");
        listofcommands(0);
    }
    
    return 0;
}